package com.hzjq.fxlib.presenter

import android.graphics.drawable.GradientDrawable
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import com.hzjq.fxlib.R
import com.wxl.common.util.DPUtil
import kotlinx.android.synthetic.main.layout_charge_progress.view.*

class ChargeProgressPresenter : AbsViewPresenter {

    constructor(rootView: ViewGroup) : super(rootView)

    override fun onContentViewId(): Int {
        return R.layout.layout_charge_progress
    }

    override fun onResume() {
        rootView.chargeProgressText.startDraw()
        rootView.chargeProgressText.setColor("#ffff0000")
        (rootView.chargeProgressLineView.background as GradientDrawable).setStroke(DPUtil.dip2px(2),ContextCompat.getColor(getContext(),android.R.color.holo_red_dark))
    }

    override fun showAction(action: String) {

    }

    override fun hide() {
        rootView.chargeProgressText.stopDraw()
    }

    override fun notifyProgressBar(action: String, p: Int) {
        rootView.chargeProgressText.setPercent(p)
    }
}